﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Volo.Abp.OpenIddict.Applications;

namespace Himp.Platform
{
    public class OpenIddictAppsService : PlatformAppService
    {
        private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository;

        public OpenIddictAppsService(IOpenIddictApplicationRepository openIddictApplicationRepository)
        {
            _openIddictApplicationRepository = openIddictApplicationRepository;
        }

        /// <summary>
        /// 获取消息业务类别
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<OpenIddictAppDto>> GetListAsync()
        {
            var list = await _openIddictApplicationRepository.GetListAsync();
            var itemsDto = ObjectMapper.Map<List<OpenIddictApplication>, List<OpenIddictAppDto>>(list);

            return new PagedResultDto<OpenIddictAppDto>(itemsDto.Count, itemsDto);
        }
    }
}
